package com.pt25.study.example.repository.sharding.converter;

import com.pt25.study.example.domain.sharding.ddo.*;
import com.pt25.study.example.repository.sharding.po.*;

public interface ShardingConverter {

    static ShardingTest ShardingTestPO2ShardingTest(ShardingTestPo shardingTestPO) {
        return shardingTestPO == null ? null : ShardingTest.builder().id(shardingTestPO.getId())
                .name(shardingTestPO.getName())
                .build();
    }

    static ShardingMs ShardingMSPO2ShardingMS(ShardingMsPo shardingMSPO) {
        return shardingMSPO == null ? null : ShardingMs.builder().id(shardingMSPO.getId())
                .name(shardingMSPO.getName())
                .build();
    }

    static ShardingSd ShardingSDPO2ShardingSD(ShardingSdPo shardingSDPO) {
        return shardingSDPO == null ? null : ShardingSd.builder().id(shardingSDPO.getId())
                .name(shardingSDPO.getName())
                .build();
    }

    static ShardingSdst ShardingSDSTPO2ShardingSDST(ShardingSdstPo shardingSDSTPO) {
        return shardingSDSTPO == null ? null : ShardingSdst.builder().id(shardingSDSTPO.getId())
                .name(shardingSDSTPO.getName())
                .build();
    }

    static ShardingSdstms ShardingSDSTMSPO2ShardingSDSTMS(ShardingSdstmsPo shardingSDSTMSPO) {
        return shardingSDSTMSPO == null ? null : ShardingSdstms.builder().id(shardingSDSTMSPO.getId())
                .name(shardingSDSTMSPO.getName())
                .build();
    }

    static ShardingS ShardingSPO2ShardingS(ShardingSPo shardingSPO) {
        return shardingSPO == null ? null : ShardingS.builder().id(shardingSPO.getId())
                .name(shardingSPO.getName())
                .build();
    }
}
